
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <include file="../simpleboot3/public@function"/>
    <script src="__TMPL__/public/assets/js/jquery-1.10.2.min.js" language="JavaScript"></script>
    <script src="__STATIC__/js/layer/layer.js"></script>
    <style>
        input{margin:10px 80px 10px 10px;}

    </style>
</head>
<body>
<!--{:url('member/recharge')}-->
<form action="" method="post" id="form3">

    会员手机号: <input type="tel" name="mobile" id="mobile" oninput="myFunction()" class="input1">
    <input type="submit" value="查询"  style="height: 35px;width: 80px" onclick="insert()"/>
</form>



<form method="post" name="form2" id="form2" action="">






    <h4>会员信息</h4>
    卡面卡号: <input type="text" name="card_id" value="" class="input2">
    会员姓名: <input type="text" name="uname"  value="" id="inp">&nbsp;<br>
    会员余额:<input type="text" name="balance"  value="">
    实收金额:<input type="text" name="money"  value=""><br>
    赠送金额:<input type="text" name="sendmoney"  value="">
    充值总金额:<input type="text" name="allmoney"  value=""><br>
    充后总余额:<input type="text" name="allmoney"  value="">
    充值时间:<input type="text" name="ctime"  value=""><br>
    充值方式:
        <select name="way" style="height: 35px;width: 80px;font-size: large">
        <option value="现金">现金</option>
        <option value="微信">微信</option>
        <option value="支付宝">支付宝</option>
        <option value="银行卡">银行卡</option>
        </select><br>




    <input type="submit" value="查询"  style="height: 35px;width: 80px" />
    <input type="submit" value="充值[Enter]" style="height: 35px;width: 80px" />
    <input type="button" value="取消" style="height: 35px;width: 80px" id="btn_cancel"/>


</form>

</body>
</html>
<script>
    function insert(){

        $.ajax({

            type: "post",//方法
            //dataType: "json",//预期服务器返回的数据类型
            url: "/home/member/recharge",//表单接收url

            data: $('#form3').serializeArray(),
            dataType : 'json',
            success: function (data) {
                alert('上传成功');
                alert(data);
                //$('#pid').html('<input type="hidden" id="tid" value="'+data.msg.con.id+'"/>');
               // $('#model').html('<input type="tel" name="mobile" id="mobile" oninput="myFunction()"  class="input1" value="'+data.msg.mobile+'" />');



               //console.log(data);//打印服务端返回的数据(调试用)

                //window.location.href="{:url('member/recharge')}";
                var jsonObj =  JSON.parse(data)
                console.log(jsonObj)
                var jsonStr1 = JSON.stringify(jsonObj)
                console.log(jsonStr1+"jsonStr1")
                var jsonArr = [];
                for(var i =0 ;i < jsonObj.length;i++){
                    jsonArr[i] = jsonObj[i];
                }
                console.log(typeof(jsonArr))


               /*var input=$(".input1").val();
                //alert(input);
                for(key in result){
                    if(input==key){
                        $(".input2").val(result['key'])
                    }
                }*/
            },
            error : function() {
               alert('失败');

            }
        });


    }

</script>
<script>
    function myFunction() {
        var x = document.getElementById("mobile").value;
        document.getElementById("inp").value = "你输入的是: " + x;


    }
</script>